/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package trabalho;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.Reader;
import java.util.ArrayList;
import java.util.Scanner;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.standard.StandardAnalyzer;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
import org.apache.lucene.document.LongField;
import org.apache.lucene.document.StringField;
import org.apache.lucene.document.TextField;
import org.apache.lucene.index.DirectoryReader;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.IndexWriter;
import org.apache.lucene.index.IndexWriterConfig;
import org.apache.lucene.index.Term;
import org.apache.lucene.queryparser.classic.ParseException;
import org.apache.lucene.queryparser.classic.QueryParser;
import org.apache.lucene.search.IndexSearcher;
import org.apache.lucene.search.Query;
import org.apache.lucene.search.ScoreDoc;
import org.apache.lucene.search.TopDocs;
import org.apache.lucene.search.TopDocsCollector;
import org.apache.lucene.store.Directory;
import org.apache.lucene.store.RAMDirectory;
import org.apache.lucene.util.PriorityQueue;
import org.apache.lucene.util.Version;

/**
 *
 * @author Felipe
 */
public class Trabalho {

    
    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        ArrayList<Documento> documentos = new FacadeDocumentos().getCacm("cacm/cacm.all");
        //ArrayList<Documento> documentos = new FacadeDocumentos().getCram("cran.all.1400");
        
        ArrayList<MyQuery> queries = new SplitQueries().getCacm("cacm/query.text");
        //ArrayList<MyQuery> queries = new SplitQueries().getCran("cran.qry");
        
        try {
        
            Analyzer analyzer = null;
        
            IndexaBase indexaBase = new IndexaBase(analyzer, documentos);       
            
            //RunQueries seachFiles = new RunQueries(indexaBase);
                     
            //seachFiles.RunOne("of heated high speed aircraft");
            //seachFiles.show();
            
            //seachFiles.RunAllQueries(queries);
           
        } catch (Exception ex) {
            Logger.getLogger(Trabalho.class.getName()).log(Level.SEVERE, null, ex);
        }
        
    }
}
